﻿using UnityEditor;
using UnityEngine;

namespace HKTools
{
    [CustomEditor(typeof(HK_FirstPersonPos))]
    public class HK_FirstPersonPosInspetor : Editor
    {
        HK_FirstPersonPos firstPersonPos;

        void OnEnable()
        {
            firstPersonPos = (HK_FirstPersonPos)target;
        }

        void OnSceneGUI()
        {
            if (firstPersonPos.transform.eulerAngles.x != 0f
                || firstPersonPos.transform.eulerAngles.z != 0f)
            {
                firstPersonPos.transform.rotation = Quaternion.Euler(0, firstPersonPos.transform.eulerAngles.y, 0);
            }
        }
    }
}